﻿using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Security.Permissions;

namespace todo
{
    [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
    [ComVisible(true)]
    public class ReminderSetterHost
    {
        private string _reminders;
        public event EventHandler OnClose;

        private void FireClose()
        {
            var handler = OnClose;
            if (handler != null) handler(this, EventArgs.Empty);
        }

        public void setReminders(string value)
        {
            _reminders = value;
        }

        public string getReminders()
        {
            return _reminders;
        }

        public void close()
        {
            FireClose();
        }

        public string GetLocalizedStrings()
        {
#if zh
            var map = new Dictionary<string, string> {
                    {"col.reminderType", "提醒类型"},
                    {"col.timingType", "时间类型"},
                    {"col.timingValue", "时间"},
                    {"action.ok", "确定"},
                    {"action.cancel", "取消"},
                    {"action.addReminder", "添加提醒"},
                    {"opt.remindType.popup", "弹出消息"},
                    {"opt.remindType.email", "电子邮件"},
                    {"opt.timingType.at", "时间点"},
                    {"opt.timingType.every", "每隔"},
                    {"opt.timingType.before", "到期之前"},
                    {"msg.noReminder", "未设置提醒"},
                    {"action.today", "今天"},
                    {"action.clear", "清除"},
                    {"monthAbbrs", "一月,二月,三月,四月,五月,六月,七月,八月,九月,十月,十一,十二"},
                    {"weekDayAbbrs", "日,一,二,三,四,五,六"},
                    {"msg.timingValueRequired", "时间值不可为空"},
                    {"msg.invalidTimingValueFormat", "无效的时间值格式"}
            };
            return fastJSON.JSON.Instance.ToJSON(map);
#else
            return null;
#endif
        }
    }
}